/*
 * Copyright 2016 Wealth Inc. All rights reserved.
 */
 package com.wealth.vote.service.impl;

import iaas.enums.StatusEnum;
import iaas.service.impl.BaseServiceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.wealth.vote.entity.Cooperative;
import com.wealth.vote.repository.CooperativeDao;
import com.wealth.vote.service.ICooperativeService;

/**
 * @author chan
 * @version 1.0
 * @since 1.0
 */
 
@Component
public class CooperativeServiceImpl extends BaseServiceImpl<Cooperative> implements ICooperativeService{

	@Autowired
	private CooperativeDao cooperativeDao;

	@Override
	public List<Cooperative> getAllByStatus() throws Exception {
		return cooperativeDao.findByStatus(StatusEnum.NORMAL.getValue());
	}

	@Override
	public List<Cooperative> getAllByStatusAndArea(Long areaid) throws Exception {
		// TODO Auto-generated method stub
		return cooperativeDao.findByStatusAndAreaId(StatusEnum.NORMAL.getValue(), areaid);
	}
	
}
